namespace PickGold.Charting
{
    using System;
    using System.Collections;
    using System.ComponentModel;

    internal class ChartDataSourceConverter : StringConverter
    {
        public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            ArrayList values = new ArrayList();
            if ((context != null) && (context.Container != null))
            {
                foreach (IComponent component in context.Container.Components)
                {
                    if (ChartImage.IsValidDataSource(component))
                    {
                        values.Add(component.Site.Name);
                    }
                }
            }
            values.Add("(none)");
            return new TypeConverter.StandardValuesCollection(values);
        }

        public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
        {
            return true;
        }

        public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
        {
            return true;
        }
    }
}

